//
//  CodableStrategy.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/3/27.
//

import Foundation
import BetterCodable
//自定义默认值


typealias DefaultBool = DefaultFalse
/** -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

// 自定义 Int 的默认值为 0
public struct IntZeroStrategy: DefaultCodableStrategy {
    public static var defaultValue: Int { 0 }
}

// 简化类型别名
typealias DefaultInt = DefaultCodable<IntZeroStrategy>

/** -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

// 自定义 String 的默认值为 ""
public struct StringEmptyStrategy: DefaultCodableStrategy {
    public static var defaultValue: String { "" }
}

// 简化类型别名
typealias DefaultString = DefaultCodable<StringEmptyStrategy>

/** -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/


// 自定义 Double 的默认值为 0.0
public struct DoubleZeroStrategy: DefaultCodableStrategy {
    public static var defaultValue: Double { 0 }
}

// 简化类型别名
typealias DefaultDouble = DefaultCodable<DoubleZeroStrategy>

/** -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

// 自定义 TimeInterval 的默认值为 0.0
public struct TimeIntervalZeroStrategy: DefaultCodableStrategy {
    public static var defaultValue: TimeInterval { 0 }
}

// 简化类型别名
typealias DefaultTimeInterval = DefaultCodable<TimeIntervalZeroStrategy>

/** -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/


// 自定义 Int64 的默认值为 0.0
public struct Int64ZeroStrategy: DefaultCodableStrategy {
    public static var defaultValue: Int64 { 0 }
}

// 简化类型别名
typealias DefaultInt64 = DefaultCodable<Int64ZeroStrategy>
